package com.zoanun.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import android.text.TextUtils;

public class DateTools {

	private static SimpleDateFormat format = new SimpleDateFormat(
			"yyyyMMddHHmmss", Locale.getDefault());

	public static Date parse(String date) {
		Date result = new Date();
		if (!TextUtils.isEmpty(date)) {
			try {
				result = format.parse(date);
			} catch (ParseException e) {
			}
		}
		return result;
	}
	
	public static String format(Date date){
		if(date != null){
			return format.format(date);
		}else{
			return format.format(new Date());
		}
	}
}
